#include "stdafx.h"
#include "fly_log.h"

TCHAR* _pcFlyLogLevel[] = {
	TEXT("[OFF]"),
	TEXT("[ERR]"),
	TEXT("[WARN]"),
	TEXT("[CLI]"),
	TEXT("[TRACE]"),
	TEXT("[DUMP]"),
	TEXT("[DBG]"),
	TEXT("[REGRW]")
};

UINT32 _nFLY_DBG_LVL = 7;

void X_Dump(unsigned char* p,size_t len)
{
	CString Out(_T('\0'),len*3+1);
	CString strTmp;
	for (size_t i=0;i<len;++i)
	{
		strTmp.Format(_T(" %02x"),p[i]);
		Out.SetAt(i*3,strTmp[0]);
		Out.SetAt(i*3+1,strTmp[1]);
		Out.SetAt(i*3+2,strTmp[2]);
	}
	Out.SetAt(Out.GetLength()-1,_T('.'));
	X_Printf("%s%s%s: %s\r\n", DBG_NAME, MODE_NAME, _pcFlyLogLevel[FLY_LOG_LVL_DUMP],Out);
}